package com.example.im.monitor

import cc.vv.lkimcomponent.lkim.listener.LKIMGroupListener
import cc.vv.lkimcomponent.lkim.operate.LKIMEdit

/**
 * 群组
 * @author  chaohaipeng  on 2018/7/23.
 */
class GroupMonitor : LKIMGroupListener {
    private object mHolder {
        val instance = GroupMonitor()
    }
    companion object {
        fun getInstance(): GroupMonitor {
            return mHolder.instance
        }
    }
    /**
     * 接收到群组加入邀请
     *
     * @param groupId
     * @param groupName
     * @param inviter
     * @param reason
     */
    override fun onInvitationReceived(groupId: String, groupName: String, inviter: String, reason: String) {}

    /**
     * 用户申请加入群
     *
     * @param groupId
     * @param groupName
     * @param applicant
     * @param reason
     */
    override fun onRequestToJoinReceived(groupId: String, groupName: String, applicant: String, reason: String) {

    }

    /**
     * 加群申请被同意
     *
     * @param groupId
     * @param groupName
     * @param accepter
     */
    override fun onRequestToJoinAccepted(groupId: String, groupName: String, accepter: String) {



    }

    /**
     * 加群申请被拒绝
     *
     * @param groupId
     * @param groupName
     * @param decliner
     * @param reason
     */
    override fun onRequestToJoinDeclined(groupId: String, groupName: String, decliner: String, reason: String) {

    }

    /**
     * 群组邀请被同意
     *
     * @param groupId
     * @param invitee
     * @param reason
     */
    override fun onInvitationAccepted(groupId: String, invitee: String, reason: String) {

    }

    /**
     * 群组邀请被拒绝
     *
     * @param groupId
     * @param invitee
     * @param reason
     */
    override fun onInvitationDeclined(groupId: String, invitee: String, reason: String) {

    }

    /**
     * 管理员移除的通知
     *
     * @param groupId
     * @param groupName
     */
    override fun onUserRemoved(groupId: String, groupName: String) {
        LKIMEdit.getInstance().delete(groupId)
//        IMReceiveService.getInstance().sendRefreshConversation()
    }

    /**
     * 群解散通知
     *
     * @param groupId
     * @param groupName
     */
    override fun onGroupDestroyed(groupId: String, groupName: String) {
        LKIMEdit.getInstance().delete(groupId)
//        IMReceiveService.getInstance().sendRefreshConversation()
    }

    /**
     * 接收邀请时自动加入到群组的通知
     *
     * @param groupId
     * @param inviter
     * @param inviteMessage
     */
    override fun onAutoAcceptInvitationFromGroup(groupId: String, inviter: String, inviteMessage: String) {

    }

    /**
     * 成员禁言的通知
     *
     * @param groupId
     * @param mutes
     * @param muteExpire
     */
    override fun onMuteListAdded(groupId: String, mutes: List<String>, muteExpire: Long) {

    }

    /**
     * 成员从禁言列表里移除通知
     *
     * @param groupId
     * @param mutes
     */
    override fun onMuteListRemoved(groupId: String, mutes: List<String>) {

    }

    /**
     * 增加管理员的通知
     *
     * @param groupId
     * @param administrator
     */
    override fun onAdminAdded(groupId: String, administrator: String) {

    }

    /**
     * 管理员移除的通知
     *
     * @param groupId
     * @param administrator
     */
    override fun onAdminRemoved(groupId: String, administrator: String) {}

    /**
     * 群所有者变动通知
     *
     * @param groupId
     * @param newOwner
     * @param oldOwner
     */
    override fun onOwnerChanged(groupId: String, newOwner: String, oldOwner: String) {}

    /**
     * 群组加入新成员通知
     *
     * @param groupId
     * @param member
     */
    override fun onMemberJoined(groupId: String, member: String) {}

    /**
     * 群成员退出通知
     *
     * @param groupId
     * @param member
     */
    override fun onMemberExited(groupId: String, member: String) {

    }

    /**
     * 群公告变动通知
     *
     * @param groupId
     * @param announcement
     */
    override fun onAnnouncementChanged(groupId: String, announcement: String) {

    }
}